﻿using System;
using System.Globalization;
using DailyDiet.Models;
using DailyDiet.util;
using Xamarin.Forms;

namespace DailyDiet.Converters
{
    /// <summary>
    /// ItemTappedEventArgs到菜品的转换器。
    /// </summary>
    public class ItemTappedEventArgsToDietConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter,
            CultureInfo culture) =>
            (value as ItemTappedEventArgs)?.Item as Diet;

        public object ConvertBack(object value, Type targetType, object parameter,
            CultureInfo culture)
        {
            throw new DoNotCallThisExcpetion();
        }
    }
}